Skip to content

feat(ws): add reconnect reconciliation with agent snapshot and hello-ack directives#185

Merged
iAziz786 merged 1 commit intohostlink-runner-refactorfrom
reconnect-reconciliation
Apr 28, 2026
Merged

feat(ws): add reconnect reconciliation with agent snapshot and hello-ack directives#185
iAziz786 merged 1 commit intohostlink-runner-refactorfrom
reconnect-reconciliation

Conversation

@iAziz786
Copy link
Copy Markdown
Contributor

Summary

Add reconnect reconciliation to ensure Hostlink and Rails reconcile task state after WebSocket reconnect before Rails sends new tasks.

Hostlink

  • HelloPayload, HelloAckPayload, and typed snapshot structs in wsprotocol message.go
  • buildHelloPayload() builds reconnect snapshot from localtaskstore.Snapshot() including running task, received-not-started attempts, unacked finals, output ranges, spool status, and client version
  • applyHelloAckLocalState() applies final ACKs and discard directives from hello-ack before marking session active
  • replayRequestedOutput() replays only the output ranges Rails requested from a given next sequence
  • Snapshot() now returns running task metadata, received attempts, unacked finals with parsed status, unacked output ranges, and spool status
  • DiscardReceived() deletes received-but-not-started attempts (safe for running/final)
  • UnackedMessagesFrom() supports targeted output replay by stream and sequence

Tests

  • wsprotocol: HelloPayload/HelloAckPayload shape and validation tests
  • localtaskstore: snapshot includes reconnect-safe state, discard safety, interrupted startup recovery
  • wsclient: hello payload includes snapshot, hello-ack directives applied correctly, discard does not erase running work

Dependencies

This change builds on PR #184 (hostlink-runner-refactor). The wsclient, localtaskstore, and wsprotocol files extend interfaces/types introduced there.

@iAziz786 iAziz786 merged commit d5bc777 into hostlink-runner-refactor Apr 28, 2026
@iAziz786 iAziz786 deleted the reconnect-reconciliation branch April 28, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant